package cn.mothin.bean.easyui;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author zhoush
 * 
 */
public class DataContent {
    public static final String TARGET_ITEM = "targetType";
    private String id;
    private String text;
    private String nameDisplay;
    private Boolean selected;
    private Boolean checked;
    private String icon;
    private String iconCls;
    private List<DataContent> children;
    private String state;
    private int ordinal;
    private Map<String, String> attributes = new HashMap<String, String>();

    public void addChild(DataContent content) {
        if (children == null) {
            children = new ArrayList<DataContent>();
        }
        children.add(content);
    }

    public void setTargetItem(boolean b) {
        attributes.put(TARGET_ITEM, String.valueOf(b));
    }

    public void setStateClosed(boolean b) {
        this.state = (b ? "closed" : "open");
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public List<DataContent> getChildren() {
        return children;
    }

    public void setChildren(List<DataContent> children) {
        this.children = children;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public String getIconCls() {
        return iconCls;
    }

    public void setIconCls(String iconCls) {
        this.iconCls = iconCls;
    }

    public Map<String, String> getAttributes() {
        return attributes;
    }

    public void setAttributes(Map<String, String> attributes) {
        this.attributes = attributes;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public Boolean getSelected() {
        return selected;
    }

    public void setSelected(Boolean selected) {
        this.selected = selected;
    }

    public Boolean getChecked() {
        return checked;
    }

    public void setChecked(Boolean checked) {
        this.checked = checked;
    }

    public String getNameDisplay() {
        return nameDisplay;
    }

    public void setNameDisplay(String nameDisplay) {
        this.nameDisplay = nameDisplay;
    }

    public int getOrdinal() {
        return ordinal;
    }

    public void setOrdinal(int ordinal) {
        this.ordinal = ordinal;
    }

}
